package club.jdiy.core.storage;

import lombok.*;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * 存储对象的MetaData数据
 *
 * @author ziquee(子秋) QQ号:39886616 主页: http://www.jdiy.club
 * @version 20200725
 */
@Data
@NoArgsConstructor
public class StoreMetaData implements Serializable {
    private StoreType type;
    private String bucket;//若为对象存储．记录对象存储的bucket. 本机存储无．
    private Map<String, List<StoreItem>> items;

    public StoreMetaData(StoreType type, String bucket, Map<String, List<StoreItem>> items) {
        this.type = type;
        this.bucket = bucket;
        this.items = items;
    }

    @Getter
    @Setter(AccessLevel.PACKAGE)
    @NoArgsConstructor
    static class StoreItem implements Serializable {
        private String key;
        private long size;
        private String ext;

        public StoreItem(String key, long size, String ext) {
            this.key = key;
            this.size = size;
            this.ext = ext;
        }
    }
}
